<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE DeriveFunctor #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE DerivingVia #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- (c) The University of Glasgow 2002-2006</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-comment">-- | The IO Monad with an environment</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- The environment is passed around as a Reader monad but</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- as its in the IO monad, mutable references can be used</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- for updating state.</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Data.IOEnv</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier">IOEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Instance of Monad</span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span>        </span><span class="hs-comment">-- Monad utilities</span><span>
</span><span id="line-19"></span><span>        </span><span class="hs-keyword">module</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span>        </span><span class="hs-comment">-- Errors</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier">failM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#failWithM"><span class="hs-identifier">failWithM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier">IOEnvFailure</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span>        </span><span class="hs-comment">-- Getting at the environment</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-identifier">getEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#setEnv"><span class="hs-identifier">setEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#updEnv"><span class="hs-identifier">updEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#runIOEnv"><span class="hs-identifier">runIOEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#unsafeInterleaveM"><span class="hs-identifier">unsafeInterleaveM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#uninterruptibleMaskM_"><span class="hs-identifier">uninterruptibleMaskM_</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#tryM"><span class="hs-identifier">tryM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#tryAllM"><span class="hs-identifier">tryAllM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#tryMostM"><span class="hs-identifier">tryMostM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier">fixM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>        </span><span class="hs-comment">-- I/O operations</span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier">IORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#newMutVar"><span class="hs-identifier">newMutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#readMutVar"><span class="hs-identifier">readMutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#writeMutVar"><span class="hs-identifier">writeMutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier">updMutVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.Data.IOEnv.html#atomicUpdMutVar"><span class="hs-identifier">atomicUpdMutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#atomicUpdMutVar%27"><span class="hs-identifier">atomicUpdMutVar'</span></a></span><span>
</span><span id="line-34"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier">IORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier">newIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier">readIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#writeIORef"><span class="hs-identifier">writeIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#modifyIORef"><span class="hs-identifier">modifyIORef</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>                          </span><span class="annot"><a href="../../base/src/Data.IORef.html#atomicModifyIORef"><span class="hs-identifier">atomicModifyIORef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#atomicModifyIORef%27"><span class="hs-identifier">atomicModifyIORef'</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier">unsafeInterleaveIO</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#fixIO"><span class="hs-identifier">fixIO</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Reader.html#"><span class="hs-identifier">Control.Monad.Trans.Reader</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#"><span class="hs-identifier">Control.Monad.Catch</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#MonadCatch"><span class="hs-identifier">MonadCatch</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#MonadMask"><span class="hs-identifier">MonadMask</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#MonadThrow"><span class="hs-identifier">MonadThrow</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier">Alternative</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.MVar.html#"><span class="hs-identifier">Control.Concurrent.MVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.MVar.html#newEmptyMVar"><span class="hs-identifier">newEmptyMVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.MVar.html#readMVar"><span class="hs-identifier">readMVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.MVar.html#putMVar"><span class="hs-identifier">putMVar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.html#"><span class="hs-identifier">Control.Concurrent</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Conc.Sync.html#forkIO"><span class="hs-identifier">forkIO</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Conc.Sync.html#killThread"><span class="hs-identifier">killThread</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- Defining the monad type</span><span>
</span><span id="line-57"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-keyword">newtype</span><span> </span><span id="IOEnv"><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span></span><span> </span><span id="local-6989586621680922969"><span class="annot"><a href="#local-6989586621680922969"><span class="hs-identifier hs-type">env</span></a></span></span><span> </span><span id="local-6989586621680922887"><span class="annot"><a href="#local-6989586621680922887"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="IOEnv"><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922969"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680922887"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680922693"><span id="local-6989586621680922697"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; IOEnv env a -&gt; IOEnv env b)
-&gt; (forall a b. a -&gt; IOEnv env b -&gt; IOEnv env a)
-&gt; Functor (IOEnv env)
forall a b. a -&gt; IOEnv env b -&gt; IOEnv env a
forall a b. (a -&gt; b) -&gt; IOEnv env a -&gt; IOEnv env b
forall env a b. a -&gt; IOEnv env b -&gt; IOEnv env a
forall env a b. (a -&gt; b) -&gt; IOEnv env a -&gt; IOEnv env b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; IOEnv env b -&gt; IOEnv env a
$c&lt;$ :: forall env a b. a -&gt; IOEnv env b -&gt; IOEnv env a
fmap :: forall a b. (a -&gt; b) -&gt; IOEnv env a -&gt; IOEnv env b
$cfmap :: forall env a b. (a -&gt; b) -&gt; IOEnv env a -&gt; IOEnv env b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680922684"><span class="annot"><span class="annottext">Monad (IOEnv env)
Monad (IOEnv env)
-&gt; (forall e a. Exception e =&gt; e -&gt; IOEnv env a)
-&gt; MonadThrow (IOEnv env)
forall {env}. Monad (IOEnv env)
forall e a. Exception e =&gt; e -&gt; IOEnv env a
forall env e a. Exception e =&gt; e -&gt; IOEnv env a
forall (m :: * -&gt; *).
Monad m -&gt; (forall e a. Exception e =&gt; e -&gt; m a) -&gt; MonadThrow m
throwM :: forall e a. Exception e =&gt; e -&gt; IOEnv env a
$cthrowM :: forall env e a. Exception e =&gt; e -&gt; IOEnv env a
</span><a href="../../exceptions/src/Control.Monad.Catch.html#C%3AMonadThrow"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var">MonadThrow</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680922669"><span class="annot"><span class="annottext">MonadThrow (IOEnv env)
MonadThrow (IOEnv env)
-&gt; (forall e a.
    Exception e =&gt;
    IOEnv env a -&gt; (e -&gt; IOEnv env a) -&gt; IOEnv env a)
-&gt; MonadCatch (IOEnv env)
forall env. MonadThrow (IOEnv env)
forall e a.
Exception e =&gt;
IOEnv env a -&gt; (e -&gt; IOEnv env a) -&gt; IOEnv env a
forall env e a.
Exception e =&gt;
IOEnv env a -&gt; (e -&gt; IOEnv env a) -&gt; IOEnv env a
forall (m :: * -&gt; *).
MonadThrow m
-&gt; (forall e a. Exception e =&gt; m a -&gt; (e -&gt; m a) -&gt; m a)
-&gt; MonadCatch m
catch :: forall e a.
Exception e =&gt;
IOEnv env a -&gt; (e -&gt; IOEnv env a) -&gt; IOEnv env a
$ccatch :: forall env e a.
Exception e =&gt;
IOEnv env a -&gt; (e -&gt; IOEnv env a) -&gt; IOEnv env a
</span><a href="../../exceptions/src/Control.Monad.Catch.html#C%3AMonadCatch"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var">MonadCatch</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680922645"><span id="local-6989586621680922650"><span id="local-6989586621680922656"><span class="annot"><span class="annottext">MonadCatch (IOEnv env)
MonadCatch (IOEnv env)
-&gt; (forall b.
    ((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
    -&gt; IOEnv env b)
-&gt; (forall b.
    ((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
    -&gt; IOEnv env b)
-&gt; (forall a b c.
    IOEnv env a
    -&gt; (a -&gt; ExitCase b -&gt; IOEnv env c)
    -&gt; (a -&gt; IOEnv env b)
    -&gt; IOEnv env (b, c))
-&gt; MonadMask (IOEnv env)
forall env. MonadCatch (IOEnv env)
forall b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
forall env b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
forall a b c.
IOEnv env a
-&gt; (a -&gt; ExitCase b -&gt; IOEnv env c)
-&gt; (a -&gt; IOEnv env b)
-&gt; IOEnv env (b, c)
forall env a b c.
IOEnv env a
-&gt; (a -&gt; ExitCase b -&gt; IOEnv env c)
-&gt; (a -&gt; IOEnv env b)
-&gt; IOEnv env (b, c)
forall (m :: * -&gt; *).
MonadCatch m
-&gt; (forall b. ((forall a. m a -&gt; m a) -&gt; m b) -&gt; m b)
-&gt; (forall b. ((forall a. m a -&gt; m a) -&gt; m b) -&gt; m b)
-&gt; (forall a b c.
    m a -&gt; (a -&gt; ExitCase b -&gt; m c) -&gt; (a -&gt; m b) -&gt; m (b, c))
-&gt; MonadMask m
generalBracket :: forall a b c.
IOEnv env a
-&gt; (a -&gt; ExitCase b -&gt; IOEnv env c)
-&gt; (a -&gt; IOEnv env b)
-&gt; IOEnv env (b, c)
$cgeneralBracket :: forall env a b c.
IOEnv env a
-&gt; (a -&gt; ExitCase b -&gt; IOEnv env c)
-&gt; (a -&gt; IOEnv env b)
-&gt; IOEnv env (b, c)
uninterruptibleMask :: forall b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
$cuninterruptibleMask :: forall env b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
mask :: forall b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
$cmask :: forall env b.
((forall a. IOEnv env a -&gt; IOEnv env a) -&gt; IOEnv env b)
-&gt; IOEnv env b
</span><a href="../../exceptions/src/Control.Monad.Catch.html#C%3AMonadMask"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">MonadMask</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680922635"><span class="annot"><span class="annottext">Monad (IOEnv env)
Monad (IOEnv env)
-&gt; (forall a. IO a -&gt; IOEnv env a) -&gt; MonadIO (IOEnv env)
forall {env}. Monad (IOEnv env)
forall a. IO a -&gt; IOEnv env a
forall env a. IO a -&gt; IOEnv env a
forall (m :: * -&gt; *).
Monad m -&gt; (forall a. IO a -&gt; m a) -&gt; MonadIO m
liftIO :: forall a. IO a -&gt; IOEnv env a
$cliftIO :: forall env a. IO a -&gt; IOEnv env a
</span><a href="../../base/src/Control.Monad.IO.Class.html#C%3AMonadIO"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var">MonadIO</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">via</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-type">ReaderT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922969"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span id="local-6989586621680922923"><span id="local-6989586621680922924"><span class="annot"><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-type">unIOEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922924"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922923"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922924"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680922923"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-65"></span><span id="unIOEnv"><span class="annot"><span class="annottext">unIOEnv :: forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var hs-var">unIOEnv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922626"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922626"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922626"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span id="local-6989586621680922625"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922619"><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922625"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-68"></span><span>    </span><span id="local-6989586621680922617"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. IOEnv m a -&gt; (a -&gt; IOEnv m b) -&gt; IOEnv m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">(&gt;&gt;=)</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv m a -&gt; (a -&gt; IOEnv m b) -&gt; IOEnv m b
forall m a b. IOEnv m a -&gt; (a -&gt; IOEnv m b) -&gt; IOEnv m b
</span><a href="GHC.Data.IOEnv.html#thenM"><span class="hs-identifier hs-var">thenM</span></a></span><span>
</span><span id="line-69"></span><span>    </span><span id="local-6989586621680922614"><span class="annot"><span class="annottext">&gt;&gt; :: forall a b. IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&gt;&gt;)</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
forall (f :: * -&gt; *) a b. Applicative f =&gt; f a -&gt; f b -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%2A%3E"><span class="hs-operator hs-var">(*&gt;)</span></a></span></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span id="local-6989586621680922904"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">MonadFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922904"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-72"></span><span>    </span><span id="local-6989586621680922608"><span class="annot"><span class="annottext">fail :: forall a. String -&gt; IOEnv m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv m a
forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var">failM</span></a></span></span><span> </span><span class="hs-comment">-- Ignore the string</span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span id="local-6989586621680922607"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922598"><span id="local-6989586621680922601"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922607"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-75"></span><span>    </span><span id="local-6989586621680922596"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; IOEnv m a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; IOEnv m a
forall a env. a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#returnM"><span class="hs-identifier hs-var">returnM</span></a></span><span>
</span><span id="line-76"></span><span>    </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922592"><span class="annot"><span class="annottext">m -&gt; IO (a -&gt; b)
</span><a href="#local-6989586621680922592"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680922591"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. IOEnv m (a -&gt; b) -&gt; IOEnv m a -&gt; IOEnv m b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922590"><span class="annot"><span class="annottext">m -&gt; IO a
</span><a href="#local-6989586621680922590"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(m -&gt; IO b) -&gt; IOEnv m b
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922589"><span class="annot"><span class="annottext">m
</span><a href="#local-6989586621680922589"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m -&gt; IO (a -&gt; b)
</span><a href="#local-6989586621680922592"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">m
</span><a href="#local-6989586621680922589"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">IO (a -&gt; b) -&gt; IO a -&gt; IO b
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">m -&gt; IO a
</span><a href="#local-6989586621680922590"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">m
</span><a href="#local-6989586621680922589"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-77"></span><span>    </span><span id="local-6989586621680922588"><span class="annot"><span class="annottext">*&gt; :: forall a b. IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
</span><a href="../../base/src/GHC.Base.html#%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(*&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
forall m a b. IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
</span><a href="GHC.Data.IOEnv.html#thenM_"><span class="hs-identifier hs-var">thenM_</span></a></span></span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span id="local-6989586621680922890"><span id="local-6989586621680922891"><span class="annot"><a href="GHC.Data.IOEnv.html#returnM"><span class="hs-identifier hs-type">returnM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680922891"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922890"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922891"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-80"></span><span id="returnM"><span class="annot"><span class="annottext">returnM :: forall a env. a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#returnM"><span class="hs-identifier hs-var hs-var">returnM</span></a></span></span><span> </span><span id="local-6989586621680922584"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922584"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">env
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; IO a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922584"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span id="local-6989586621680922581"><span id="local-6989586621680922582"><span id="local-6989586621680922583"><span class="annot"><a href="GHC.Data.IOEnv.html#thenM"><span class="hs-identifier hs-type">thenM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922583"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922582"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922582"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922583"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922581"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922583"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922581"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-83"></span><span id="thenM"><span class="annot"><span class="annottext">thenM :: forall m a b. IOEnv m a -&gt; (a -&gt; IOEnv m b) -&gt; IOEnv m b
</span><a href="GHC.Data.IOEnv.html#thenM"><span class="hs-identifier hs-var hs-var">thenM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922579"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922579"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680922578"><span class="annot"><span class="annottext">a -&gt; IOEnv env b
</span><a href="#local-6989586621680922578"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO b) -&gt; IOEnv env b
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922577"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922577"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680922576"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922576"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922579"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922577"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">;</span><span>
</span><span id="line-84"></span><span>                                         </span><span class="annot"><span class="annottext">IOEnv env b -&gt; env -&gt; IO b
forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var">unIOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; IOEnv env b
</span><a href="#local-6989586621680922578"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922576"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922577"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span id="local-6989586621680922573"><span id="local-6989586621680922574"><span id="local-6989586621680922575"><span class="annot"><a href="GHC.Data.IOEnv.html#thenM_"><span class="hs-identifier hs-type">thenM_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922575"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922574"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922575"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922573"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922575"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922573"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-87"></span><span id="thenM_"><span class="annot"><span class="annottext">thenM_ :: forall m a b. IOEnv m a -&gt; IOEnv m b -&gt; IOEnv m b
</span><a href="GHC.Data.IOEnv.html#thenM_"><span class="hs-identifier hs-var hs-var">thenM_</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922571"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922571"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680922570"><span class="annot"><span class="annottext">IOEnv env b
</span><a href="#local-6989586621680922570"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO b) -&gt; IOEnv env b
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922569"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922569"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922571"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922569"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IOEnv env b -&gt; env -&gt; IO b
forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var">unIOEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv env b
</span><a href="#local-6989586621680922570"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922569"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span id="local-6989586621680922901"><span id="local-6989586621680922902"><span class="annot"><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-type">failM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922902"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922901"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-90"></span><span id="failM"><span class="annot"><span class="annottext">failM :: forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var hs-var">failM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">env
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOEnvFailure -&gt; IO a
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnvFailure
</span><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-var">IOEnvFailure</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span id="local-6989586621680922564"><span id="local-6989586621680922565"><span class="annot"><a href="GHC.Data.IOEnv.html#failWithM"><span class="hs-identifier hs-type">failWithM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922565"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922564"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-93"></span><span id="failWithM"><span class="annot"><span class="annottext">failWithM :: forall m a. String -&gt; IOEnv m a
</span><a href="GHC.Data.IOEnv.html#failWithM"><span class="hs-identifier hs-var hs-var">failWithM</span></a></span></span><span> </span><span id="local-6989586621680922563"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680922563"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">env
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO a
forall a. IOError -&gt; IO a
</span><a href="../../base/src/GHC.IO.Exception.html#ioError"><span class="hs-identifier hs-var">ioError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; IOError
</span><a href="../../base/src/GHC.IO.Exception.html#userError"><span class="hs-identifier hs-var">userError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680922563"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-keyword">data</span><span> </span><span id="IOEnvFailure"><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-var">IOEnvFailure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="IOEnvFailure"><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-var">IOEnvFailure</span></a></span></span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922556"><span id="local-6989586621680922559"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-type">IOEnvFailure</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-98"></span><span>    </span><span id="local-6989586621680922554"><span class="annot"><span class="annottext">show :: IOEnvFailure -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var hs-var hs-var hs-var">show</span></a></span></span><span> </span><span class="annot"><span class="annottext">IOEnvFailure
</span><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-var">IOEnvFailure</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;IOEnv failure&quot;</span></span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922543"><span id="local-6989586621680922545"><span id="local-6989586621680922547"><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#Exception"><span class="hs-identifier hs-type">Exception</span></a></span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-type">IOEnvFailure</span></a></span></span></span></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span id="local-6989586621680922859"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#ContainsDynFlags"><span class="hs-identifier hs-type">ContainsDynFlags</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922859"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#HasDynFlags"><span class="hs-identifier hs-type">HasDynFlags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922859"><span class="hs-identifier hs-type">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-103"></span><span>    </span><span id="local-6989586621680922534"><span class="annot"><span class="annottext">getDynFlags :: IOEnv env DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var hs-var hs-var hs-var">getDynFlags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680922532"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922532"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv env env
forall env. IOEnv env env
</span><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span>
</span><span id="line-104"></span><span>                     </span><span class="annot"><span class="annottext">DynFlags -&gt; IOEnv env DynFlags
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; IOEnv env DynFlags) -&gt; DynFlags -&gt; IOEnv env DynFlags
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">env -&gt; DynFlags
forall t. ContainsDynFlags t =&gt; t -&gt; DynFlags
</span><a href="GHC.Driver.Session.html#extractDynFlags"><span class="hs-identifier hs-var">extractDynFlags</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922532"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span id="local-6989586621680922848"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#ContainsModule"><span class="hs-identifier hs-type">ContainsModule</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922848"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#HasModule"><span class="hs-identifier hs-type">HasModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922848"><span class="hs-identifier hs-type">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-107"></span><span>    </span><span id="local-6989586621680922522"><span class="annot"><span class="annottext">getModule :: IOEnv env Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var hs-var hs-var hs-var">getModule</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680922520"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922520"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv env env
forall env. IOEnv env env
</span><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span>
</span><span id="line-108"></span><span>                   </span><span class="annot"><span class="annottext">Module -&gt; IOEnv env Module
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Module -&gt; IOEnv env Module) -&gt; Module -&gt; IOEnv env Module
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">env -&gt; Module
forall t. ContainsModule t =&gt; t -&gt; Module
</span><a href="GHC.Unit.Module.html#extractModule"><span class="hs-identifier hs-var">extractModule</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922520"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- Fundamental combinators specific to the monad</span><span>
</span><span id="line-112"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-116"></span><span id="local-6989586621680922845"><span id="local-6989586621680922846"><span class="annot"><a href="GHC.Data.IOEnv.html#runIOEnv"><span class="hs-identifier hs-type">runIOEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680922846"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922846"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922845"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680922845"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-117"></span><span id="runIOEnv"><span class="annot"><span class="annottext">runIOEnv :: forall env a. env -&gt; IOEnv env a -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#runIOEnv"><span class="hs-identifier hs-var hs-var">runIOEnv</span></a></span></span><span> </span><span id="local-6989586621680922518"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922518"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922517"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922517"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922517"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922518"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-121"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-pragma hs-type">fixM</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-122"></span><span>  </span><span class="hs-comment">-- Aargh!  Not inlining fixM alleviates a space leak problem.</span><span>
</span><span id="line-123"></span><span>  </span><span class="hs-comment">-- Normally fixM is used with a lazy tuple match: if the optimiser is</span><span>
</span><span id="line-124"></span><span>  </span><span class="hs-comment">-- shown the definition of fixM, it occasionally transforms the code</span><span>
</span><span id="line-125"></span><span>  </span><span class="hs-comment">-- in such a way that the code generator doesn't spot the selector</span><span>
</span><span id="line-126"></span><span>  </span><span class="hs-comment">-- thunks.  Sigh.</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span id="local-6989586621680922841"><span id="local-6989586621680922842"><span class="annot"><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier hs-type">fixM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922842"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922841"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922842"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922841"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922842"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-129"></span><span id="fixM"><span class="annot"><span class="annottext">fixM :: forall a env. (a -&gt; IOEnv env a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier hs-var hs-var">fixM</span></a></span></span><span> </span><span id="local-6989586621680922516"><span class="annot"><span class="annottext">a -&gt; IOEnv env a
</span><a href="#local-6989586621680922516"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922515"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922515"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a -&gt; IO a) -&gt; IO a
forall a. (a -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.IO.html#fixIO"><span class="hs-identifier hs-var">fixIO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922514"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922514"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOEnv env a -&gt; env -&gt; IO a
forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var">unIOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; IOEnv env a
</span><a href="#local-6989586621680922516"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922514"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922515"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-133"></span><span id="local-6989586621680922836"><span id="local-6989586621680922837"><span class="annot"><a href="GHC.Data.IOEnv.html#tryM"><span class="hs-identifier hs-type">tryM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922837"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922836"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922837"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-type">IOEnvFailure</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922836"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-134"></span><span class="hs-comment">-- Reflect UserError exceptions (only) into IOEnv monad</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- Other exceptions are not caught; they are simply propagated as exns</span><span>
</span><span id="line-136"></span><span class="hs-comment">--</span><span>
</span><span id="line-137"></span><span class="hs-comment">-- The idea is that errors in the program being compiled will give rise</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- to UserErrors.  But, say, pattern-match failures in GHC itself should</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- not be caught here, else they'll be reported as errors in the program</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- begin compiled!</span><span>
</span><span id="line-141"></span><span id="tryM"><span class="annot"><span class="annottext">tryM :: forall env r. IOEnv env r -&gt; IOEnv env (Either IOEnvFailure r)
</span><a href="GHC.Data.IOEnv.html#tryM"><span class="hs-identifier hs-var hs-var">tryM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922513"><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922513"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO (Either IOEnvFailure r))
-&gt; IOEnv env (Either IOEnvFailure r)
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922512"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922512"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IO r -&gt; IO (Either IOEnvFailure r)
forall a. IO a -&gt; IO (Either IOEnvFailure a)
</span><a href="GHC.Data.IOEnv.html#tryIOEnvFailure"><span class="hs-identifier hs-var">tryIOEnvFailure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922513"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922512"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span id="local-6989586621680922833"><span class="annot"><a href="GHC.Data.IOEnv.html#tryIOEnvFailure"><span class="hs-identifier hs-type">tryIOEnvFailure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680922833"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnvFailure"><span class="hs-identifier hs-type">IOEnvFailure</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922833"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-144"></span><span id="tryIOEnvFailure"><span class="annot"><span class="annottext">tryIOEnvFailure :: forall a. IO a -&gt; IO (Either IOEnvFailure a)
</span><a href="GHC.Data.IOEnv.html#tryIOEnvFailure"><span class="hs-identifier hs-var hs-var">tryIOEnvFailure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO (Either IOEnvFailure a)
forall e a. Exception e =&gt; IO a -&gt; IO (Either e a)
</span><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier hs-var">try</span></a></span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span id="local-6989586621680922828"><span id="local-6989586621680922829"><span class="annot"><a href="GHC.Data.IOEnv.html#tryAllM"><span class="hs-identifier hs-type">tryAllM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922829"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922828"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922829"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922828"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-147"></span><span class="hs-comment">-- Catch *all* synchronous exceptions</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- This is used when running a Template-Haskell splice, when</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- even a pattern-match failure is a programmer error</span><span>
</span><span id="line-150"></span><span id="tryAllM"><span class="annot"><span class="annottext">tryAllM :: forall env r. IOEnv env r -&gt; IOEnv env (Either SomeException r)
</span><a href="GHC.Data.IOEnv.html#tryAllM"><span class="hs-identifier hs-var hs-var">tryAllM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922508"><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922508"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO (Either SomeException r))
-&gt; IOEnv env (Either SomeException r)
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922507"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922507"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IO r -&gt; IO (Either SomeException r)
forall a. IO a -&gt; IO (Either SomeException a)
</span><a href="GHC.Data.IOEnv.html#safeTry"><span class="hs-identifier hs-var">safeTry</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922508"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922507"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-comment">-- | Like 'try', but doesn't catch asynchronous exceptions</span><span>
</span><span id="line-153"></span><span id="local-6989586621680922825"><span class="annot"><a href="GHC.Data.IOEnv.html#safeTry"><span class="hs-identifier hs-type">safeTry</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680922825"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922825"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-154"></span><span id="safeTry"><span class="annot"><span class="annottext">safeTry :: forall a. IO a -&gt; IO (Either SomeException a)
</span><a href="GHC.Data.IOEnv.html#safeTry"><span class="hs-identifier hs-var hs-var">safeTry</span></a></span></span><span> </span><span id="local-6989586621680922497"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680922497"><span class="hs-identifier hs-var">act</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-155"></span><span>  </span><span id="local-6989586621680922496"><span class="annot"><span class="annottext">MVar (Either SomeException a)
</span><a href="#local-6989586621680922496"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (MVar (Either SomeException a))
forall a. IO (MVar a)
</span><a href="../../base/src/GHC.MVar.html#newEmptyMVar"><span class="hs-identifier hs-var">newEmptyMVar</span></a></span><span>
</span><span id="line-156"></span><span>  </span><span class="hs-comment">-- uninterruptible because we want to mask around 'killThread', which is interruptible.</span><span>
</span><span id="line-157"></span><span>  </span><span class="annot"><span class="annottext">((forall a. IO a -&gt; IO a) -&gt; IO (Either SomeException a))
-&gt; IO (Either SomeException a)
forall b. ((forall a. IO a -&gt; IO a) -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.IO.html#uninterruptibleMask"><span class="hs-identifier hs-var">uninterruptibleMask</span></a></span><span> </span><span class="annot"><span class="annottext">(((forall a. IO a -&gt; IO a) -&gt; IO (Either SomeException a))
 -&gt; IO (Either SomeException a))
-&gt; ((forall a. IO a -&gt; IO a) -&gt; IO (Either SomeException a))
-&gt; IO (Either SomeException a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680922494"><span class="annot"><span class="annottext">forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680922494"><span class="hs-identifier hs-var">restore</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-comment">-- Fork, so that 'act' is safe from all asynchronous exceptions other than the ones we send it</span><span>
</span><span id="line-159"></span><span>    </span><span id="local-6989586621680922493"><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680922493"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO ThreadId
</span><a href="../../base/src/GHC.Conc.Sync.html#forkIO"><span class="hs-identifier hs-var">forkIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ThreadId) -&gt; IO () -&gt; IO ThreadId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; IO a -&gt; IO (Either e a)
</span><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier hs-var">try</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO a -&gt; IO a
forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680922494"><span class="hs-identifier hs-var">restore</span></a></span><span> </span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680922497"><span class="hs-identifier hs-var">act</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IO (Either SomeException a)
-&gt; (Either SomeException a -&gt; IO ()) -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Either SomeException a) -&gt; Either SomeException a -&gt; IO ()
forall a. MVar a -&gt; a -&gt; IO ()
</span><a href="../../base/src/GHC.MVar.html#putMVar"><span class="hs-identifier hs-var">putMVar</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Either SomeException a)
</span><a href="#local-6989586621680922496"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-160"></span><span>    </span><span class="annot"><span class="annottext">IO (Either SomeException a) -&gt; IO (Either SomeException a)
forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680922494"><span class="hs-identifier hs-var">restore</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MVar (Either SomeException a) -&gt; IO (Either SomeException a)
forall a. MVar a -&gt; IO a
</span><a href="../../base/src/GHC.MVar.html#readMVar"><span class="hs-identifier hs-var">readMVar</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Either SomeException a)
</span><a href="#local-6989586621680922496"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>      </span><span class="annot"><span class="annottext">IO (Either SomeException a)
-&gt; (SomeException -&gt; IO (Either SomeException a))
-&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; IO a -&gt; (e -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#catch"><span class="hs-operator hs-var">`catch`</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621680922491"><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680922491"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-162"></span><span>        </span><span class="hs-comment">-- Control reaches this point only if the parent thread was sent an async exception</span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-comment">-- In that case, kill the 'act' thread and re-raise the exception</span><span>
</span><span id="line-164"></span><span>        </span><span class="annot"><span class="annottext">ThreadId -&gt; IO ()
</span><a href="../../base/src/GHC.Conc.Sync.html#killThread"><span class="hs-identifier hs-var">killThread</span></a></span><span> </span><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680922493"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><span class="annottext">SomeException -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680922491"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span id="local-6989586621680922489"><span id="local-6989586621680922490"><span class="annot"><a href="GHC.Data.IOEnv.html#tryMostM"><span class="hs-identifier hs-type">tryMostM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922490"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922489"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922490"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922489"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-168"></span><span id="tryMostM"><span class="annot"><span class="annottext">tryMostM :: forall env r. IOEnv env r -&gt; IOEnv env (Either SomeException r)
</span><a href="GHC.Data.IOEnv.html#tryMostM"><span class="hs-identifier hs-var hs-var">tryMostM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922488"><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922488"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO (Either SomeException r))
-&gt; IOEnv env (Either SomeException r)
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922487"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922487"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IO r -&gt; IO (Either SomeException r)
forall a. IO a -&gt; IO (Either SomeException a)
</span><a href="GHC.Utils.Panic.html#tryMost"><span class="hs-identifier hs-var">tryMost</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; IO r
</span><a href="#local-6989586621680922488"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922487"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-171"></span><span id="local-6989586621680922811"><span id="local-6989586621680922812"><span class="annot"><a href="GHC.Data.IOEnv.html#unsafeInterleaveM"><span class="hs-identifier hs-type">unsafeInterleaveM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922812"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922811"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922812"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922811"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-172"></span><span id="unsafeInterleaveM"><span class="annot"><span class="annottext">unsafeInterleaveM :: forall env a. IOEnv env a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#unsafeInterleaveM"><span class="hs-identifier hs-var hs-var">unsafeInterleaveM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922485"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922485"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922484"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922484"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO a
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922485"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922484"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span id="local-6989586621680922482"><span id="local-6989586621680922483"><span class="annot"><a href="GHC.Data.IOEnv.html#uninterruptibleMaskM_"><span class="hs-identifier hs-type">uninterruptibleMaskM_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922483"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922482"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922483"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922482"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-175"></span><span id="uninterruptibleMaskM_"><span class="annot"><span class="annottext">uninterruptibleMaskM_ :: forall env a. IOEnv env a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#uninterruptibleMaskM_"><span class="hs-identifier hs-var hs-var">uninterruptibleMaskM_</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922481"><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922481"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922480"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922480"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO a
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#uninterruptibleMask_"><span class="hs-identifier hs-var">uninterruptibleMask_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; IO a
</span><a href="#local-6989586621680922481"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922480"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-178"></span><span class="hs-comment">-- Alternative/MonadPlus</span><span>
</span><span id="line-179"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span id="local-6989586621680922802"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922471"><span id="local-6989586621680922473"><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922802"><span class="hs-identifier hs-type">env</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>    </span><span id="local-6989586621680922467"><span class="annot"><span class="annottext">empty :: forall a. IOEnv env a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var hs-var hs-var hs-var">empty</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO a -&gt; env -&gt; IO a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">IO a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>    </span><span id="local-6989586621680922463"><span class="annot"><span class="annottext">IOEnv env a
</span><a href="#local-6989586621680922463"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680922462"><span class="annot"><span class="annottext">&lt;|&gt; :: forall a. IOEnv env a -&gt; IOEnv env a -&gt; IOEnv env a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;|&gt;</span></a></span></span><span> </span><span id="local-6989586621680922460"><span class="annot"><span class="annottext">IOEnv env a
</span><a href="#local-6989586621680922460"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680922459"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922459"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOEnv env a -&gt; env -&gt; IO a
forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var">unIOEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv env a
</span><a href="#local-6989586621680922463"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922459"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO a -&gt; IO a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a -&gt; f a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var">&lt;|&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv env a -&gt; env -&gt; IO a
forall env a. IOEnv env a -&gt; env -&gt; IO a
</span><a href="GHC.Data.IOEnv.html#unIOEnv"><span class="hs-identifier hs-var">unIOEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv env a
</span><a href="#local-6989586621680922460"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922459"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span id="local-6989586621680922794"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680922451"><span id="local-6989586621680922453"><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922794"><span class="hs-identifier hs-type">env</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-188"></span><span class="hs-comment">-- Accessing input/output</span><span>
</span><span id="line-189"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span id="local-6989586621680922792"><span id="local-6989586621680922793"><span class="annot"><a href="GHC.Data.IOEnv.html#newMutVar"><span class="hs-identifier hs-type">newMutVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680922793"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922792"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922793"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-192"></span><span id="newMutVar"><span class="annot"><span class="annottext">newMutVar :: forall a env. a -&gt; IOEnv env (IORef a)
</span><a href="GHC.Data.IOEnv.html#newMutVar"><span class="hs-identifier hs-var hs-var">newMutVar</span></a></span></span><span> </span><span id="local-6989586621680922448"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922448"><span class="hs-identifier hs-var">val</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef a) -&gt; IOEnv env (IORef a)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; IO (IORef a)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922448"><span class="hs-identifier hs-var">val</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span id="local-6989586621680922786"><span id="local-6989586621680922787"><span class="annot"><a href="GHC.Data.IOEnv.html#writeMutVar"><span class="hs-identifier hs-type">writeMutVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922787"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680922787"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922786"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-195"></span><span id="writeMutVar"><span class="annot"><span class="annottext">writeMutVar :: forall a env. IORef a -&gt; a -&gt; IOEnv env ()
</span><a href="GHC.Data.IOEnv.html#writeMutVar"><span class="hs-identifier hs-var hs-var">writeMutVar</span></a></span></span><span> </span><span id="local-6989586621680922445"><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922445"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621680922444"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922444"><span class="hs-identifier hs-var">val</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IOEnv env ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef a -&gt; a -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="../../base/src/GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922445"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680922444"><span class="hs-identifier hs-var">val</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span id="local-6989586621680922781"><span id="local-6989586621680922782"><span class="annot"><a href="GHC.Data.IOEnv.html#readMutVar"><span class="hs-identifier hs-type">readMutVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922782"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922781"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922782"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-198"></span><span id="readMutVar"><span class="annot"><span class="annottext">readMutVar :: forall a env. IORef a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#readMutVar"><span class="hs-identifier hs-var hs-var">readMutVar</span></a></span></span><span> </span><span id="local-6989586621680922442"><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922442"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IOEnv env a
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef a -&gt; IO a
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922442"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span id="local-6989586621680922776"><span id="local-6989586621680922777"><span class="annot"><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier hs-type">updMutVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922777"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922777"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680922777"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922776"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-201"></span><span id="updMutVar"><span class="annot"><span class="annottext">updMutVar :: forall a env. IORef a -&gt; (a -&gt; a) -&gt; IOEnv env ()
</span><a href="GHC.Data.IOEnv.html#updMutVar"><span class="hs-identifier hs-var hs-var">updMutVar</span></a></span></span><span> </span><span id="local-6989586621680922440"><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922440"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621680922439"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680922439"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IOEnv env ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef a -&gt; (a -&gt; a) -&gt; IO ()
forall a. IORef a -&gt; (a -&gt; a) -&gt; IO ()
</span><a href="../../base/src/Data.IORef.html#modifyIORef"><span class="hs-identifier hs-var">modifyIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922440"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680922439"><span class="hs-identifier hs-var">upd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-comment">-- | Atomically update the reference.  Does not force the evaluation of the</span><span>
</span><span id="line-204"></span><span class="hs-comment">-- new variable contents.  For strict update, use 'atomicUpdMutVar''.</span><span>
</span><span id="line-205"></span><span id="local-6989586621680922770"><span id="local-6989586621680922771"><span id="local-6989586621680922772"><span class="annot"><a href="GHC.Data.IOEnv.html#atomicUpdMutVar"><span class="hs-identifier hs-type">atomicUpdMutVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922772"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922772"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922772"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680922771"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922770"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922771"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-206"></span><span id="atomicUpdMutVar"><span class="annot"><span class="annottext">atomicUpdMutVar :: forall a b env. IORef a -&gt; (a -&gt; (a, b)) -&gt; IOEnv env b
</span><a href="GHC.Data.IOEnv.html#atomicUpdMutVar"><span class="hs-identifier hs-var hs-var">atomicUpdMutVar</span></a></span></span><span> </span><span id="local-6989586621680922437"><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922437"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621680922436"><span class="annot"><span class="annottext">a -&gt; (a, b)
</span><a href="#local-6989586621680922436"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO b -&gt; IOEnv env b
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef a -&gt; (a -&gt; (a, b)) -&gt; IO b
forall a b. IORef a -&gt; (a -&gt; (a, b)) -&gt; IO b
</span><a href="../../base/src/Data.IORef.html#atomicModifyIORef"><span class="hs-identifier hs-var">atomicModifyIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922437"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (a, b)
</span><a href="#local-6989586621680922436"><span class="hs-identifier hs-var">upd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-comment">-- | Strict variant of 'atomicUpdMutVar'.</span><span>
</span><span id="line-209"></span><span id="local-6989586621680922433"><span id="local-6989586621680922434"><span id="local-6989586621680922435"><span class="annot"><a href="GHC.Data.IOEnv.html#atomicUpdMutVar%27"><span class="hs-identifier hs-type">atomicUpdMutVar'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922435"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922435"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922435"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680922434"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922433"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922434"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-210"></span><span id="atomicUpdMutVar%27"><span class="annot"><span class="annottext">atomicUpdMutVar' :: forall a b env. IORef a -&gt; (a -&gt; (a, b)) -&gt; IOEnv env b
</span><a href="GHC.Data.IOEnv.html#atomicUpdMutVar%27"><span class="hs-identifier hs-var hs-var">atomicUpdMutVar'</span></a></span></span><span> </span><span id="local-6989586621680922431"><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922431"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621680922430"><span class="annot"><span class="annottext">a -&gt; (a, b)
</span><a href="#local-6989586621680922430"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO b -&gt; IOEnv env b
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef a -&gt; (a -&gt; (a, b)) -&gt; IO b
forall a b. IORef a -&gt; (a -&gt; (a, b)) -&gt; IO b
</span><a href="../../base/src/GHC.IORef.html#atomicModifyIORef%27"><span class="hs-identifier hs-var">atomicModifyIORef'</span></a></span><span> </span><span class="annot"><span class="annottext">IORef a
</span><a href="#local-6989586621680922431"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (a, b)
</span><a href="#local-6989586621680922430"><span class="hs-identifier hs-var">upd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-213"></span><span class="hs-comment">-- Accessing the environment</span><span>
</span><span id="line-214"></span><span class="hs-comment">----------------------------------------------------------------------</span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span id="local-6989586621680922858"><span class="annot"><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-identifier hs-type">getEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922858"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922858"><span class="hs-identifier hs-type">env</span></a></span></span><span>
</span><span id="line-217"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-pragma hs-type">getEnv</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-218"></span><span id="getEnv"><span class="annot"><span class="annottext">getEnv :: forall env. IOEnv env env
</span><a href="GHC.Data.IOEnv.html#getEnv"><span class="hs-identifier hs-var hs-var">getEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO env) -&gt; IOEnv env env
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922428"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922428"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">env -&gt; IO env
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922428"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span class="hs-comment">-- | Perform a computation with a different environment</span><span>
</span><span id="line-221"></span><span id="local-6989586621680922758"><span id="local-6989586621680922759"><span id="local-6989586621680922760"><span class="annot"><a href="GHC.Data.IOEnv.html#setEnv"><span class="hs-identifier hs-type">setEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680922760"><span class="hs-identifier hs-type">env'</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922760"><span class="hs-identifier hs-type">env'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922759"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922758"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922759"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-222"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#setEnv"><span class="hs-pragma hs-type">setEnv</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-223"></span><span id="setEnv"><span class="annot"><span class="annottext">setEnv :: forall env' a env. env' -&gt; IOEnv env' a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#setEnv"><span class="hs-identifier hs-var hs-var">setEnv</span></a></span></span><span> </span><span id="local-6989586621680922427"><span class="annot"><span class="annottext">env'
</span><a href="#local-6989586621680922427"><span class="hs-identifier hs-var">new_env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922426"><span class="annot"><span class="annottext">env' -&gt; IO a
</span><a href="#local-6989586621680922426"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">env
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">env' -&gt; IO a
</span><a href="#local-6989586621680922426"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">env'
</span><a href="#local-6989586621680922427"><span class="hs-identifier hs-var">new_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="hs-comment">-- | Perform a computation with an altered environment</span><span>
</span><span id="line-226"></span><span id="local-6989586621680922752"><span id="local-6989586621680922753"><span id="local-6989586621680922754"><span class="annot"><a href="GHC.Data.IOEnv.html#updEnv"><span class="hs-identifier hs-type">updEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680922754"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680922753"><span class="hs-identifier hs-type">env'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922753"><span class="hs-identifier hs-type">env'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922752"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922754"><span class="hs-identifier hs-type">env</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680922752"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-227"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#updEnv"><span class="hs-pragma hs-type">updEnv</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-228"></span><span id="updEnv"><span class="annot"><span class="annottext">updEnv :: forall env env' a. (env -&gt; env') -&gt; IOEnv env' a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#updEnv"><span class="hs-identifier hs-var hs-var">updEnv</span></a></span></span><span> </span><span id="local-6989586621680922425"><span class="annot"><span class="annottext">env -&gt; env'
</span><a href="#local-6989586621680922425"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span id="local-6989586621680922424"><span class="annot"><span class="annottext">env' -&gt; IO a
</span><a href="#local-6989586621680922424"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(env -&gt; IO a) -&gt; IOEnv env a
forall env a. (env -&gt; IO a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-var">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621680922423"><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922423"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">env' -&gt; IO a
</span><a href="#local-6989586621680922424"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">env -&gt; env'
</span><a href="#local-6989586621680922425"><span class="hs-identifier hs-var">upd</span></a></span><span> </span><span class="annot"><span class="annottext">env
</span><a href="#local-6989586621680922423"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-229"></span></pre></body></html>